package com.hu.bgp.framework.clientapi;

import com.google.gwt.user.client.rpc.IsSerializable;

public class GameID implements IsSerializable
{
	private String gameAlias;
	private String gameID;
	
	public GameID(){
	}
	
	public GameID(String gameAlias)
	{
		this.gameAlias = gameAlias;
	}

	public GameID(String fullGameIDString, boolean fromFullGameIDstring)
	{
		String id[] = fullGameIDString.split("@");
		if (id.length == 2)
		{
			gameID = id[0];
			gameAlias = id[1];
		}
		else{
			throw new IllegalArgumentException("The full game id string must be formated like: <gameID>@<gameAlias>");
		}
	}
	
	public String getGameAlias()
	{
		return this.gameAlias;
	}
	public String getGameID()
	{
		return gameID;
	}

	public void setGameID(String gameID)
	{
		this.gameID = gameID;
	}

	public String toString()
	{
		return gameID + "@" + gameAlias;
	}
}
